<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

//密码加密
function encryptPass($pass){
    return md5('hbdd'.md5('jmsm+'.$pass));
}
//构造数据库字段 类似thinkphp 3.2 的create()；
use think\Db;
function createtabledata($table = '',$filter_data){
    //表字段
    $TableFields = Db::table('sm_'.$table)->getTableFields();
    //过滤前数据
    $data = [];
    foreach ($TableFields as $k => $v) {
        if (!empty($filter_data[$v])) {
            $data[$v] = $filter_data[$v];
        }
    }
    return $data;
}
//隐藏内容数据
function formatNewsDetailForSign($str,$length = 80){
    $str = strip_tags($str);
    $str = trim($str);
    $string = mb_substr($str,0,$length,'utf-8');
    $string .= '...';
    return $string;
}